import type {CommandRegistryItem, Command} from './command.type'

// 命令工厂类
export class CommandFactory {
  static create(registryItem: CommandRegistryItem, params: any[]): Command {
    return {
      moduleName: registryItem.moduleName,
      type: registryItem.type,
      commandName: registryItem.commandName,
      handler: registryItem.handler,
      params,
      ...(registryItem.context ? { context: registryItem.context } : {})
    };
  }
}